Repository navigation
feat(scope): keep a FRET mode formula in the scope itself - #271
Merged
Merged
Conversation
FRET scopes over a mode formula, such as `in (PCVMode | PSVMode)`, were imported as a fresh output atom plus a non-weakenable guarantee `G(m <-> f)`. That definition inflated the spec, and the repair search had to carry it as an extra output and an extra guarantee. `Scope::m_mode` may now hold the formula itself. A bare mode lowers, hashes and serialises byte-for-byte as before, so no determinism golden moved. Mutation never edits a mode and similarity compares it as text, and both are unchanged. A formula mode stays out of `modes`, and counting adds the formula's atoms. The importer writes the canonical formula and drops the fresh atom. examples/ventilator-controller is re-imported: guarantees go from 68 to 58, outputs from 63 to 53 and modes from 20 to 10. Checks: - ctest passes 70/70, and lint and format are clean. - All 11 formula-mode requirements are equivalent under ltlfilt to FRET's ftExpanded at ordinal ticks. - Of the 58 new guarantees, 47 have identical LTL. The other 11 are ltlfilt-equivalent to the old ones with the mode atom replaced by its definition. The assumption is unchanged. - Two small `in (a | b)` specs give the same realize verdict both ways: one is realizable and one is not. - The full ventilator was not put through realize, which is too slow.
The crash-report test sent SIGSEGV with kill() right after the run printed "Seed: 7". Starting the search lazily builds the global thread pool. glibc blocks every signal in the thread that calls pthread_create, so the new worker starts with the signal unblocked, and a process-directed signal can land on it before TSan has attached that thread. TSan then aborts with "CHECK failed: tsan_interceptors_posix.cpp:2184 ((thr->slot)) != (0)". Send the signal to the main thread with tgkill() instead. The main thread holds it pending until it unblocks signals, so the handler still runs on a thread TSan knows. tgkill is Linux-only, so other platforms keep kill(). Measured locally under TSan: 7 of 40 runs failed before this change and 0 of 30 failed after it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A FRET scope may name a mode formula, such as
in (PCVMode | PSVMode). The importer used to give each one a fresh output atom,mode_pcv_mode_or_psv_mode, and a non-weakenable definitionG(mode_pcv_mode_or_psv_mode <-> (pcv_mode | psv_mode)).Scope::m_modenow holds the formula itself, as FRET does.Engine changes:
(pcv_mode) | (psv_mode), is bracketed in the scope templates, and stays out ofmodes. Mutation never edits a mode, and similarity still compares it as text.scope_mode_atoms), which keepscount_guard_modelsclear of the overflow assertion.examples/ventilator-controlleris re-imported. It has 58 guarantees, 53 outputs and 10 modes, where it had 68, 63 and 20. Campaigns run on it before this change used the old spec, which their provenance tags still reproduce.Checks:
lintandformatare clean.ltlfilt --equivalent-toto FRET'sftExpanded, at ordinal ticks.ltlfilt-equivalent to their old form with themode_*atom replaced by its definition. The assumption is unchanged. Because each fresh atom was an output fixed by its definition, the two specifications are equisynthesizable.in (a | b)specifications, one realizable and one not, give the samerealizeverdict as formula modes and as fresh atoms. A fullrealizeon the ventilator does not finish in reasonable time, so it was not run.The trade-off is a mode field that now carries a small formula language, in exchange for 10 fewer atoms in the ventilator's mutation pool and model counts.